package com.untour.im.client.command;

import com.untour.im.codec.protocol.serialize.Serializer;
import com.untour.im.codec.protocol.serialize.json.JSONSerializer;

import java.util.HashMap;
import java.util.Map;

public class SerializerCodec {

    private static final Map<Byte, Serializer> serializerMap;

    static  {
        // 序列化协议ID 和 协议实现类 映射
        serializerMap = new HashMap<>();
        Serializer serializer = new JSONSerializer();
        serializerMap.put(serializer.getSerializerAlgorithm(), serializer);
    }

    public static Serializer getSerializer(byte serializerType) {
        return SerializerCodec.serializerMap.get(serializerType);
    }

}
